home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / trem.zip / CHAR.C < prev    next >
Text File  |  1991-05-11  |  2KB  |  68 lines

  1. /************************************************************************
  2.  *
  3.  *    Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *-----------------------------------------------------------------------
  6.  *
  7.  *     Project:  Windows Terminal Example
  8.  *
  9.  *      Module:  char.c
  10.  *
  11.  *      Author:  Bryan A. Woodruff (baw)
  12.  *
  13.  *
  14.  *     Remarks:  Writes a character to the comm port and
  15.  *               if necessary, echos back to terminal.
  16.  *
  17.  *               This module could actually perform some keyboard
  18.  *               remapping, but it doesn't.
  19.  *
  20.  *   Revisions:  
  21.  *     01.00.000  5/11/91 baw   Wrote it.
  22.  *
  23.  ************************************************************************/
  24.  
  25. #include "terminal.h"
  26.  
  27. /************************************************************************
  28.  *  BOOL WriteCharacter( HWND hWnd, BYTE bOut )
  29.  *
  30.  *  Description: 
  31.  *     This simply writes a character to the port and echos it
  32.  *     to the terminal screen if fLocalEcho is set.  Some minor
  33.  *     keyboard mapping could be performed here.
  34.  *
  35.  *  Comments:
  36.  *      5/11/91  baw  Wrote it.
  37.  *
  38.  ************************************************************************/
  39.  
  40. BOOL WriteCharacter( HWND hWnd, BYTE bOut )
  41. {
  42.    LOCALHANDLE  hTermInfo ;
  43.    NPTERMINFO   npTermInfo ;
  44.  
  45.    hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
  46.    if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
  47.       return ( FALSE ) ;
  48.  
  49.    if (!npTermInfo -> fConnected)
  50.    {
  51.       LocalUnlock( hTermInfo ) ;
  52.       return ( FALSE ) ;
  53.    }
  54.  
  55.    WriteCommByte( hWnd, bOut ) ;
  56.    if (npTermInfo -> fLocalEcho)
  57.       WriteTerminalByte( hWnd, bOut ) ;
  58.  
  59.    LocalUnlock( hTermInfo ) ;
  60.    return ( TRUE ) ;
  61.  
  62. } /* end of WriteCharacter() */
  63.  
  64. /************************************************************************
  65.  * End of File: char.c
  66.  ************************************************************************/
  67.  
  68.